﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
using TemplateTEst.Abstract;
using TemplateTEst.Concrete.Cell;
using TemplateTEst.Concrete.Cell.Inner;
using TemplateTEst.Interface;

namespace TemplateTEst.Concrete.Table
{
    public class Table : TempControl
    {

        private List<ITableCell> cellList;
        public override List<ITableCell> CellList
        {
            get
            {
                if (cellList == null)
                {
                    cellList = new List<ITableCell>();

                    var cellLst = new TableCell();

                    foreach (var item in Data.GetData())
                    {

                        cellLst.Icon = "ICON";
                        cellLst.CellInnerList = new List<ICellInnerItem>();

                        cellLst.CellInnerList.Add(new CellInner { Css = "bold", Text = item.Name });
                        cellLst.CellInnerList.Add(new CellInner { Css = "bold", Text = item.Adress });
                        cellLst.CellInnerList.Add(new CellInner { Css = "bold", Text = item.No });
                        cellLst.CellInnerList.Add(new CellInner { Css = "bold", Text = item.Old.ToString() });
                        cellLst.CellInnerList.Add(new CellInner { Css = "bold", Text = item.Sex });
                        cellLst.CellInnerList.Add(new CellInner { Css = "bold", Text = item.Surname });
                        cellLst.GetSearchKey(item);
                        CellList.Add(cellLst);

                
                        
                    }
                }

                return cellList;
            }
            set
            {
                cellList = value;
            }
        }
    }
}
